package com.example.demo.client.vm.gateway;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.Date;

/**
 * Description:
 *
 * @Author zmf
 * @Date 2018/12/7  9:45
 */
@ApiModel("在线用户信息")
public class OnlineUserVm implements Serializable{
    private static final long serialVersionUID = -4827097196180592837L;
    public OnlineUserVm(){
    }

    public OnlineUserVm(String userName, String ip, Date loginTime, String accessToken) {
        this.userName = userName;
        this.ip = ip;
        this.loginTime = loginTime;
        this.accessToken = accessToken;
    }
    @ApiModelProperty("用户名")
    private String userName;
    @ApiModelProperty("登录IP")
    private String ip;
    @ApiModelProperty("心跳时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date loginTime;
    @JsonIgnore
    private String accessToken;
    @ApiModelProperty("是否被强制下线")
    @JsonIgnore
    private boolean offline = false;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public boolean isOffline() {
        return offline;
    }

    public void setOffline(boolean offline) {
        this.offline = offline;
    }

    @Override
    public String toString() {
        return "OnlineUserVm{" +
            "userName='" + userName + '\'' +
            ", ip='" + ip + '\'' +
            ", loginTime=" + loginTime +
            ", accessToken='" + accessToken + '\'' +
            ", offline=" + offline +
            '}';
    }
}
